<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<div id="header">
    <div class="hdrl"></div>
    <div class="hdrr"></div>
    
    <h1><a href="<%=request.getContextPath()%>">NTB</a></h1>
    
    <ul id="nav">
        <li><html:link action="/admin/dashboard.do">
            Dashboard
        </html:link></li>
        <logic:iterate id="menuItem" name="menuList">
            <bean:size id="menuSize" name="menuItem" property="childs"/>
            <logic:greaterThan name="menuSize" value="0">
                <logic:equal name="menuSize" value="1">
                    
                    <logic:iterate id="child" name="menuItem" property="childs">
                        <li 
                            <logic:notEmpty name="menuItem" property="active">
                                class="active"
                            </logic:notEmpty>
                            >
                            <html:link action='/admin/${child[0]}Listing.do'>
                            ${child[1]}
                            </html:link>
                            </li>
                    </logic:iterate>
                </logic:equal>
                <logic:greaterThan name="menuSize" value="1">
                    <li 
                        <logic:notEmpty name="menuItem" property="active">
                            class="active"
                        </logic:notEmpty>
                        ><a class="has_childs" href="#">${menuItem["name"]}</a>
                        <ul>
                            <logic:iterate id="child" name="menuItem" property="childs">
                                <li>
                                    <html:link action='/admin/${child[0]}Listing.do'>
                                    ${child[1]}
                                    </html:link>
                                </li>
                            </logic:iterate>
                        </ul>
                    </li>
                </logic:greaterThan>
            </logic:greaterThan>
        </logic:iterate>
    </ul>
    
    <p class="user">Hello, <html:link action="/admin/profile.do"><bean:write name="currentUser" property="fullName"/></html:link> | <html:link action="/admin/logout.do">Logout</html:link></p>
</div>
<!-- #header ends -->
